﻿package mortal.game.view.ThanksGiving.panel
{
    import com.mui.controls.*;
    import extend.language.*;
    import mortal.component.window.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.view.ThanksGiving.data.*;
    import mortal.game.view.combinedServer.item.*;
    import mortal.game.view.common.*;
    import mortal.game.view.copy.GroupTowerCopy.data.*;
    import mortal.game.view.rebate.item.*;

    public class ThanksGivingBossPanel extends GSprite
    {
        protected var _timeTxt:GTextFiled;
        protected var _ruleTxt:GTextFiled;
        protected var _list:CellsGridSprite;
        protected var _enterBtn:GLoadingButton;
        private var _actionSp:ShowActionPlayerSp;

        public function ThanksGivingBossPanel()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._actionSp = UIFactory.getUICompoment(ShowActionPlayerSp);
            this._actionSp.setXYWH(211, 37, 685, 556);
            this._actionSp.window = GameController.thanksGiving.view as Window;
            this._actionSp.img2DUrl = "ThanksGivingBossBg.swf";
            var _loc_1:* = ThanksGivingUtil.bossMesh;
            var _loc_2:* = ThanksGivingUtil.bossBone;
            var _loc_3:* = ThanksGivingUtil.bossTextur;
            this._actionSp.setPlayer(_loc_1, _loc_2, _loc_3, 233, 469, 2, 2, 2);
            this.addChild(this._actionSp);
            this._timeTxt = UIFactory.gTextField("", 321, 188, 320, 20, this);
            this._ruleTxt = UIFactory.gTextField("", 681, 277, 200, 90, this);
            this._ruleTxt.multiline = true;
            this._ruleTxt.wordWrap = true;
            this._list = UIFactory.getUICompoment(CellsGridSprite);
            this._list.colNum = 4;
            this._list.vCellWid = 45;
            this._list.hCellWid = 50;
            this._list.genCellFun = this.genItem;
            this._list.genCells(8);
            this._list.x = 685;
            this._list.y = 400;
            this.addChild(this._list);
            this._enterBtn = UIFactory.gLoadingButton(ImagesConst.tower_win_go2_upSkin, 710, 532, 157, 39, this);
            this._enterBtn.label = "";
            this._actionSp.top3dSp.addChild(this._timeTxt);
            this._actionSp.top3dSp.addChild(this._ruleTxt);
            this._actionSp.top3dSp.addChild(this._list);
            this._actionSp.top3dSp.addChild(this._enterBtn);
            this.updateRuleAndTime();
            this._enterBtn.visible = false;
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._timeTxt = null;
            this._ruleTxt = null;
            this._list = null;
            this._enterBtn = null;
            this._actionSp = null;
            super.disposeImpl(param1);
            return;
        }// end function

        private function genItem() : RebateItem2
        {
            var _loc_1:* = UIFactory.getUICompoment(RebateItem2);
            return _loc_1;
        }// end function

        private function updateRuleAndTime() : void
        {
            this._timeTxt.text = "" + ThanksGivingUtil.getOpenTimeStr();
            this._ruleTxt.htmlText = Language.getString(71408);
            var _loc_1:* = ThanksGivingUtil.bossGiftCode;
            RewardCfgUtil.updateRwListByGiftCode(_loc_1, this._list);
            var _loc_2:* = this._list.cellArr.length / this._list.colNum;
            this._list.y = 396 + (96 - this._list.hCellWid * _loc_2) / 2;
            return;
        }// end function

    }
}
